package com.gollum.init;

import com.gollum.system.service.InitSystemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * 系统初始化
 *
 * @author Herther
 * @version 1.0.0
 * @createTime 2022年09月04日 21:47:00
 */
@Component
@Slf4j
public class SysInit implements CommandLineRunner {

    @Autowired
    protected InitSystemService initSystemService;

    @Override
    public void run(String... args) throws Exception {
        Boolean hasInitParam = initSystemService.hasInitParam();
        if (hasInitParam){
            log.info("----------------------正在初始化系统参数到缓存----------------------");
            //初始化系统参数配置
            initSystemService.initSystemConfig();

        }
    }

}
